package com.example.lets;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

/**
 * Created by Administrator on 2015/12/16.
 */
public class HomePullableView extends RelativeLayout implements Pullable {

    HomeActivity home;

    public HomePullableView(Context context)
    {
        super(context);
        home = (HomeActivity) context;
        //getChildView();
    }

    public HomePullableView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        home = (HomeActivity) context;
        //getChildView();
    }

    public HomePullableView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs, defStyle);
        home = (HomeActivity) context;
        //getChildView();
    }

    //private void getChildView() {
    //    imgView = getChildAt(1);
    //}

    @Override
    public boolean canPullDown()
    {
        return HomeActivity.isTop;
    }

    @Override
    public boolean canPullUp()
    {
        if (HomeActivity.hasNew) {
            HomeActivity.hasNew = false;
            return false;
        }
        return home.ifReachBottom();
    }
}